/*
 *  Copyright (C) 2019 刘臣轩
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of 
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include "RuneParam.h"

RuneParam runeParam;

void RuneParam::LoadParam()
{
    cv::FileStorage fs("RuneParam.yml", cv::FileStorage::READ);
    fs["rad"] >> runeParam.rad;
    fs["pi2"] >> runeParam.pi2;
    fs["frame_interval_s"] >> runeParam.frame_interval_s;
    fs["predict_time"] >> runeParam.predict_time;
    
    fs["imgproc_mode"] >> runeParam.imgproc_mode;
    fs["blue_thresh"] >> runeParam.blue_thresh;
    fs["red_thresh"] >> runeParam.red_thresh;
    fs["ed_times"] >> runeParam.ed_times;
    
    fs["r_max_ratio"] >> runeParam.r_max_ratio;
    // fs["r_min_ratio"] >> runeParam.r_max_ratio;
    fs["r_min_area"] >> runeParam.r_min_area;
    fs["r_max_area"] >> runeParam.r_max_area;
    
    fs["leaf_min_area"] >> runeParam.leaf_min_area;
    fs["leaf_max_area"] >> runeParam.leaf_max_area;
    fs["leaf_min_ratio"] >> runeParam.leaf_min_ratio;
    fs["leaf_max_ratio"] >> runeParam.leaf_max_ratio;

    fs["armor_min_area"] >> runeParam.armor_min_area;
    fs["armor_max_area"] >> runeParam.armor_max_area;
    fs["armor_min_ratio"] >> runeParam.armor_min_ratio;
    fs["armor_max_ratio"] >> runeParam.armor_max_ratio;

    fs["R2armor_min_dist"] >> runeParam.R2armor_min_dist;
    fs["R2armor_max_dist"] >> runeParam.R2armor_max_dist;
    
    fs["estimation_1"] >> runeParam.estimation_1;
    fs["estimation_2"] >> runeParam.estimation_2;
    fs["estimation_3"] >> runeParam.estimation_3;
    fs["estimation_4"] >> runeParam.estimation_4;

    
    fs.release();
}
